#include "Object.h"

void Object::applyForce(Force f)
{
	this->forces.push_back(f);
}

void Object::update(float dt,SDL_Renderer* renderer)
{
	for (auto& f : forces)
	{

		this->velocity += f.getForce()/mass;

		

		if (f.getType() == 0)
		{
			forces.erase(std::find(forces.begin(), forces.end(), f));
		}
	}


	this->position += this->velocity*dt;

	

}

vec2 Object::getPosition()
{
	return position;
}

vec2 Object::getVelocity()
{
	return velocity;
}

float Object::getMass()
{
	return mass;
}

void Object::setPosition(float x, float y)
{

	this->position = vec2(x, y);
}

void Object::setdynamic(bool is)
{
	 this->isDynamic = is;
}

bool Object::getdynamic()
{
	return isDynamic;
}

quat Object::getrotation()
{
	return rotation;
}

void Object::setrotation(quat q)
{
	this->rotation = q;


}

void Object::setVelocity(vec2 v)
{
	this->velocity = v;
}
